{include file='common/head'}
<body>
<div class="x-body">
    <form class="layui-form" method="post" action="{:url('index/jiaose/setquan')}" enctype="multipart/form-data">
        <div class="layui-form-item">
            <div class="layui-input-inline">
			    <span class="x-black">为</span><span style="font-size:large"><?php echo $res['jname'];?></span><span>设置权限</span>
                
            </div>
           
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>选择权限
            </label>
            <div class="layui-input-inline">
			{foreach $data as $k}
                <input type="checkbox" name="access[]" checked="checked"
			      value="<?php echo $k['0']['id'];?>" /> <?php echo $k['0']['title'].'<br>';?>

			{/foreach}

			{volist name="result" id="val"}
                <input type="checkbox" name="access[]" 
			      value="{$val.id}" /> {$val.title}<br>
			{/volist}
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
			<input type="hidden" value="<?php echo $res['id'];?>" name="hid">
            </label>
            <button  class="layui-btn" lay-filter="setquan" lay-submit="" >
               提交
            </button>
        </div>
    </form>
</div>
<script>
	 layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //自定义验证规则
        //监听提交
        form.on('submit(setquan)', function(data){
            console.log(data);
            //ar url="";
            $.ajax({
                type: "post",
                async:false,
                url: "{:url('index/jiaose/setquan')}",
                data: data.field,
                success:function(msg){
					if(msg.code==1){
						layer.msg(msg.msg,{icon:1,time:1000});
                        setTimeout(function () {
                            window.parent.location.reload();//刷新父级窗口
                        }, 1000);
					}else{
					    layer.msg(msg.msg,{icon:1,time:1000});
					}
				}
        })
            return false;
        });


    });
    </script>
</body>

</html>